import {reactive, ref} from "vue";

export function useFiles() {
    const types1 = reactive({
        all: {
            icon: 'chat-folder',
            name: '全部'
        },
        recently: {
            icon: 'chat-time-circle',
            name: '最近使用'
        }
    })

    const types2 = reactive({
        user: {
            icon: 'chat-user',
            name: '发送者'
        },
        chat: {
            icon: 'chat-message',
            name: '聊天'
        },
        type: {
            icon: 'chat-file-text',
            name: '聊天'
        },
    })

    let typeActive = ref('all')

    //切换分类
    function switchType(type:string) {
        if ((!types1.hasOwnProperty(type) && !types2.hasOwnProperty(type)) || typeActive.value === type) {
            return;
        }

        typeActive.value = type;
    }

    return {typeActive, switchType, types1, types2};
}